import { FC } from 'react'
import classNames from 'classnames'
// 提供了在 React 应用中使用 FontAwesome 图标的组件。
// 依赖于 @fortawesome/fontawesome-svg-core 和 @fortawesome/free-solid-svg-icons（或其他 FontAwesome 图标库）
import { FontAwesomeIcon, FontAwesomeIconProps } from '@fortawesome/react-fontawesome'

export type ThemeProps = 'primary' | 'secondary' | 'success' | 'info' | 'warning' | 'danger' | 'light' | 'dark'
export interface IconProps extends FontAwesomeIconProps {
  theme?: ThemeProps // 框架主题
}

/**
 * 基于 react-fontawesome https://github.com/FortAwesome/react-fontawesome#basic
 * 所有图标 https://fontawesome.com/icons?d=gallery&s=solid&m=free
 */

const FuckingIcon: FC<IconProps> = (props) => {
  const {
    className,
    theme = 'primary', // 默认主题
    ...restProps
  } = props
  const classes = classNames(className, {
    [`icon-${theme}`]: theme
  })
  return <FontAwesomeIcon className={classes} {...restProps} />
}

export default FuckingIcon
